package Year21_Month10.day1030;

import java.util.LinkedList;
import java.util.Queue;


public class MyStack {
    Queue<Integer> a;
    Queue<Integer> b;
    int size = 0;
    public MyStack() {
        a = new LinkedList();
        b = new LinkedList();
    }

    public void push(int x) {
        b.offer(x);
        while(a != null){
            b.offer(a.poll());
        }
        Queue tmp = a;
        a = b;
        b = tmp;
    }

    public int pop() {
        return a.poll();
    }

    public int top() {
        return a.peek();
    }

    public boolean empty() {
        return a.isEmpty();
    }
}
